package com.zr.service.impl;

import java.util.ArrayList;
import java.util.List;

import com.zr.dao.ZLCSuserdao;
import com.zr.dao.Zlroledao;
import com.zr.dao.impl.ZLCSuserdaoimpl;
import com.zr.dao.impl.Zlroleimpl;
import com.zr.model.User;
import com.zr.service.mainserver;

import net.sf.json.JSONArray;
import net.sf.json.util.NewBeanInstanceStrategy;

public class mainserverimpl implements mainserver{
     ZLCSuserdao ud = new ZLCSuserdaoimpl();
     Zlroledao rd = new Zlroleimpl();
	@Override
	//对用户进行角色设置
	public void  setuser(int uid ,int rid) {
		ud.setuser(uid, rid);
		
	}

	@Override
	 //用json获得所有角色数据
	public JSONArray allrole() {
		JSONArray jsons= new JSONArray();
		jsons = rd.allrole();
		return jsons;
	}

	@Override
	 //获得从state行开始的rows条用户数据
	public List<User> alluser(int state, int rows) {
		List<User> list = new ArrayList<>();
		list = ud.alluser(state, rows);
		return list;
	}
	public int count(){
		ZLCSuserdao zlu = new ZLCSuserdaoimpl();
		
		return zlu.counts();
	}


}
